home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / INFO / READBACK.ZIP / READBACK.C next >
C/C++ Source or Header  |  1991-12-04  |  861b  |  30 lines

  1. /*************************************************************************
  2.  
  3.                                READBACK.C
  4.  
  5. A diagnostic utility.  This program reads its arguments and prints them
  6. to the screen, followed by any text redirected to stdin.  Copy this
  7. program to a different name, such as RMAIL, and you'll be able to see
  8. what the calling program (like Waffle) is telling it.  This can be very
  9. helpful in figuring out how programs interact.
  10.  
  11. This program is in the public domain.
  12.  
  13. *************************************************************************/
  14.  
  15. #include <stdio.h>
  16. #include <io.h>
  17.  
  18. main(int argc, char *argv[]) {
  19.     int x;
  20.  
  21.     for(x=0;x<argc;x++)
  22.         printf("Arg %d: %s\n",x,argv[x]);
  23.     printf("\n");
  24.     if (!isatty(0)) {
  25.         while ((x = getchar()) != EOF) {
  26.             putchar(x);
  27.         }
  28.     }
  29. }
  30.